package top.hours48.ddbearapi.controller;


import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.hours48.ddbearapi.handler.ConfigHandler;
import top.hours48.ddbearapi.handler.SessionHandler;
import top.hours48.ddbearapi.model.RespVO;
import top.hours48.ddbearapi.model.config.MenuMO;

import java.util.List;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/config")
public class ConfigController {
    Logger logger = LoggerFactory.getLogger(ConfigController.class);

    @Autowired
    private ConfigHandler configHandler;

    // @RequestParam Long userId, @RequestParam String pageName,
    @RequestMapping(value = "/menus", method = RequestMethod.GET)
    public List<MenuMO> menus(
                              HttpServletRequest servletRequest, HttpServletResponse servletResponse) {

        List menus = configHandler.queryMenus(1, "HOME_PAGE");
        return menus;
    }
}



